package com.demo.starter.job;

import com.demo.starter.service.IArticleCrawlService;
import com.demo.starter.service.IQuartzService;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.time.StopWatch;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.Date;

/**
 * est_news 抓取任务
 */
@Log4j2
public class EstNewsCrawlJob implements  Job,Serializable {

	private static final long serialVersionUID = 1L;
	   
    @Autowired
    private IArticleCrawlService articleCrawlService;
    
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		log.info("[JOB-EXECUTE] <start>: est_news 抓取任务");
        StopWatch sw = new StopWatch();
        sw.start();
		articleCrawlService.fetchDetail();
        sw.stop();
		log.info("[JOB-EXECUTE] <end>: est_news 抓取任务, 耗时：{}s", sw.getTime());
	}
}
